import { nullDisplay } from '@/components/FormatterView/utils'
export const REF_TABLE = 'gridTable'
export const CUSTOM_CONFIG = {
  ref: REF_TABLE,
  unifiedTrade: {
    label: '商品/订单号/退款号',
    prop: 'refundDetail',
    resizable: false,
    render: (h, params, ctx) => {
      var trade = params.row.unifiedTrade
      if (!trade) {
        return nullDisplay(h, {
          nullText: '无'
        })
      } else {
        return h('em-cell', {
          props: {
            title: trade.trade_no,
            size: 'small',
            type: 'media'
          },
          scopedSlots: {
            // title: () => {
            //   return h('em-currency', {
            //     props: {
            //       value: row.refund_pay,
            //       color: row.refund_time ? 'success' : 'warning'
            //     }
            //   })
            // },
            label: () => {
              return h(
                'em-descriptions',
                {
                  props: {
                    column: 1,
                    size: 'mini',
                    border: false,
                    labelValign: 'middle',
                    labelSuffix: '：'
                  }
                },
                [
                  h(
                    'em-descriptions-item',
                    {
                      props: {
                        label: '交易金额'
                      }
                    },
                    trade.total
                  ),
                  h(
                    'em-descriptions-item',
                    {
                      props: {
                        label: '积分金额'
                      }
                    },
                    trade.credit
                  ),
                  h(
                    'em-descriptions-item',
                    {
                      props: {
                        label: '现金金额'
                      }
                    },
                    trade.cash
                  )
                ]
              )
            }
          }
        })
      }
    }
  }
}
